<?php
namespace Admin\Controller;
use Think\Controller;
class SortController extends Controller {
    public function index(){
        $Sort = M('sorts');
        // dump($Sort);
        $data=$Sort->select();
        // dump($data);die;
        foreach ($data as $key => $value) {
            $info=$Sort->find($value['pid']);
            if(empty($info)){
                $data[$key]['pname']="顶级分类";
            }else{
                $data[$key]['pname']=$info['name'];
            }
            // dump($info);die;
        }
        // dump($data);exit;
        $this->assign('data',$data);
        $this->display();
    }
}